import request from '@/api/request'
/**
 * 读取字典列表
 */
export const getDictionaryList = (params) => {
    return request.get(`/dictionary`,params)
}
/**
 * 创建字典
 * @param data
 */
export const createDictionary = (data: any) => {
    return request.post(`/dictionary`, data)
}
/**
 * 更新字典
 * @param id
 * @param data
 */
export const updateDictionary = (id: number, data: any) => {
    return request.put(`/dictionary/${id}`, data)
}
/**
 * 删除字典
 * @param id
 */
export const deleteDictionary = (id: number) => {
    return request.delete(`/dictionary/${id}`)
}

/**
 * 获取字典数据源
 * @param id
 */
export const getDictionaryData = (id:number)=>{
    return request.get('/dictionary_data',{dictionary_id:id})
}

/**
 * 添加字典数据源
 * @param data
 */
export const createDictionaryData = (data:DictionaryData)=>{
    return request.post('/dictionary_data',data)
}
/**
 * 更新字典数据源
 * @param id
 * @param data
 */
export const updateDictionaryData = (id:number,data:any)=>{
    return request.put(`/dictionary_data/${id}`,data)
}
/**
 * 删除数据源
 * @param id
 */
export const deleteDictionaryData = (id:number)=>{
    return request.delete(`/dictionary_data/${id}`)
}